package com.xiaomaoguai.springmvc.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.fasterxml.jackson.annotation.JsonView;

/**
 * @Description :
 * @FileName: JacksonJsonViewController.java
 * @Author :WeiHui.Zhang
 * @Data : 2015年10月28日 上午10:49:37
 * @Version:V1.00
 */
@RestController
@RequestMapping("json")
public class JacksonJsonViewController {

	@RequestMapping("/jackson1")
	@JsonView(User.OnlyIdView.class)
	public User test1() {
		return new User(1L, "zhangsan");
	}

	@RequestMapping("/jackson2")
	@JsonView(User.OnlyNameView.class)
	public User test2() {
		return new User(1L, "zhangsan");
	}

	@RequestMapping("/jackson3")
	@JsonView(User.AllView.class) // 可以省略
	public User test3() {
		return new User(1L, "zhangsan");
	}
}
